<?php
if (!$con = mysql_connect('localhost', 'root', 'rootpass')) {
    echo 'Could not connect to mysql';
    exit;
}
if (!mysql_select_db('honeyviz', $con)) {
    echo 'Could not select database';
    exit;
}
$query = 	"SELECT latitude, longitude, city
		FROM locations.locations
		WHERE city NOT LIKE '%default%'
		GROUP BY city
		ORDER BY city;";
$result = mysql_query($query);
echo "<?xml version = '1.0' ?><data>";
while ($row = mysql_fetch_assoc($result)) {
	echo "<item>";
	echo "<city>" . $row['city'] . "</city>";
	echo "<latitude>" . $row['latitude'] . "</latitude>";
	echo "<longitude>" . $row['longitude'] . "</longitude>";
	echo "</item>";
}
echo "</data>";
mysql_close($con);
?>
